package com.punai.customer.controller;

import com.punai.common.annotation.Log;
import com.punai.common.core.controller.BaseController;
import com.punai.common.core.domain.AjaxResult;
import com.punai.common.core.page.TableDataInfo;
import com.punai.common.enums.BusinessType;
import com.punai.customer.domain.CusLinkFbFeature;
import com.punai.customer.domain.contants.CusConstants;
import com.punai.customer.service.ICusLinkFbFeatureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 分包费用项特征关联Controller
 * 
 * @author zxw
 * @date 2022-12-09
 */
@RestController
@RequestMapping("/cus/linkFbFeature")
public class CusLinkFbFeatureController extends BaseController
{
    @Autowired
    private ICusLinkFbFeatureService dmcLinkFbFeatureService;

    /**
     * 查询分包费用项特征关联列表
     */
    @PreAuthorize("@ss.hasPermi('dmc:linkFbFeature:list')")
    @GetMapping("/list")
    public TableDataInfo list(CusLinkFbFeature dmcLinkFbFeature)
    {
        startPage();
        List<CusLinkFbFeature> list = dmcLinkFbFeatureService.selectDmcLinkFbFeatureList(dmcLinkFbFeature);
        return getDataTable(list);
    }

    /**
     * 获取分包费用项特征关联详细信息
     */
    @PreAuthorize("@ss.hasPermi('dmc:linkFbFeature:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(dmcLinkFbFeatureService.selectDmcLinkFbFeatureById(id));
    }

    /**
     * 新增分包费用项特征关联
     */
    @PreAuthorize("@ss.hasPermi('dmc:linkFbFeature:add')")
    @Log(title = CusConstants.FB_NAME + "特征关联", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CusLinkFbFeature dmcLinkFbFeature)
    {
        return toAjax(dmcLinkFbFeatureService.insertDmcLinkFbFeature(dmcLinkFbFeature));
    }

    /**
     * 修改分包费用项特征关联
     */
    @PreAuthorize("@ss.hasPermi('dmc:linkFbFeature:edit')")
    @Log(title = CusConstants.FB_NAME + "特征关联", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CusLinkFbFeature dmcLinkFbFeature)
    {
        return toAjax(dmcLinkFbFeatureService.updateDmcLinkFbFeature(dmcLinkFbFeature));
    }

    /**
     * 删除分包费用项特征关联
     */
    @PreAuthorize("@ss.hasPermi('dmc:linkFbFeature:remove')")
    @Log(title = CusConstants.FB_NAME + "特征关联", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(dmcLinkFbFeatureService.deleteDmcLinkFbFeatureByIds(ids));
    }
}
